package com.gdawj.javabeans;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
public class Cours implements Serializable {
    
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long idCours;
    private String libelle;
    @Temporal(TemporalType.DATE)
    private Date dateCours=new Date();
    private String duree;
    private String description;
    // lien vers la classe Promotion
    @ManyToOne(cascade=CascadeType.PERSIST)
    private Promotion promotion;
    // lien vers la classe Matiere
    @ManyToOne(cascade=CascadeType.PERSIST)
    private Matiere matiere;
    // lien vers la classe EtudiantCours
    @OneToMany(mappedBy="cours",cascade={CascadeType.PERSIST,CascadeType.REMOVE})
    private List<EtudiantCours> listeEtudiants;
    

    public Cours()
    {
        System.out.println("Dans le constructeur de la classe Cours");
    }

    public Date getDateCours() {
        return dateCours;
    }

    public void setDateCours(Date dateCours) {
        this.dateCours = dateCours;
    }

    
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDuree() {
        return duree;
    }

    public void setDuree(String duree) {
        this.duree = duree;
    }

    public Long getIdCours() {
        return idCours;
    }

    public void setIdCours(Long idCours) {
        this.idCours = idCours;
    }

    public String getLibelle() {
        return libelle;
    }

    public void setLibelle(String libelle) {
        this.libelle = libelle;
    }

    public List<EtudiantCours> getListeEtudiants() {
        return listeEtudiants;
    }

    public void setListeEtudiants(List<EtudiantCours> listeEtudiants) {
        this.listeEtudiants = listeEtudiants;
    }

    public Matiere getMatiere() {
        return matiere;
    }

    public void setMatiere(Matiere matiere) {
        this.matiere = matiere;
    }

    public Promotion getPromotion() {
        return promotion;
    }

    public void setPromotion(Promotion promotion) {
        this.promotion = promotion;
    }
 
    
    
}
